From 9daab81ab5d9de07224c21023e0220b8ae975b19 Mon Sep 17 00:00:00 2001 From: Benjamin Otte Date: Mon, 6 Sep 2010 16:20:30 +0200 Subject: [PATCH] separatortoolitem: Port to draw vfunc --- gtk/gtkseparatortoolitem.c | 13 +++++------ gtk/gtktoolbar.c | 46 ++++++++++++++++++++------------------ gtk/gtktoolbar.h | 3 +-- 3 files changed, 31 insertions(+), 31 deletions(-) diff --git a/gtk/gtkseparatortoolitem.c b/gtk/gtkseparatortoolitem.c index 139cd25c1b..d8ebb6354a 100644 --- a/gtk/gtkseparatortoolitem.c +++ b/gtk/gtkseparatortoolitem.c @@ -70,8 +70,8 @@ static void gtk_separator_tool_item_size_request (GtkWidget GtkRequisition *requisition); static void gtk_separator_tool_item_size_allocate (GtkWidget *widget, GtkAllocation *allocation); -static gboolean gtk_separator_tool_item_expose (GtkWidget *widget, - GdkEventExpose *event); +static gboolean gtk_separator_tool_item_draw (GtkWidget *widget, + cairo_t *cr); static void gtk_separator_tool_item_add (GtkContainer *container, GtkWidget *child); static gint get_space_size (GtkToolItem *tool_item); @@ -120,7 +120,7 @@ gtk_separator_tool_item_class_init (GtkSeparatorToolItemClass *class) object_class->get_property = gtk_separator_tool_item_get_property; widget_class->size_request = gtk_separator_tool_item_size_request; widget_class->size_allocate = gtk_separator_tool_item_size_allocate; - widget_class->expose_event = gtk_separator_tool_item_expose; + widget_class->draw = gtk_separator_tool_item_draw; widget_class->realize = gtk_separator_tool_item_realize; widget_class->unrealize = gtk_separator_tool_item_unrealize; widget_class->map = gtk_separator_tool_item_map; @@ -340,8 +340,8 @@ gtk_separator_tool_item_button_event (GtkWidget *widget, } static gboolean -gtk_separator_tool_item_expose (GtkWidget *widget, - GdkEventExpose *event) +gtk_separator_tool_item_draw (GtkWidget *widget, + cairo_t *cr) { GtkAllocation allocation; GtkToolbar *toolbar = NULL; @@ -356,8 +356,7 @@ gtk_separator_tool_item_expose (GtkWidget *widget, toolbar = GTK_TOOLBAR (parent); gtk_widget_get_allocation (widget, &allocation); - _gtk_toolbar_paint_space_line (widget, toolbar, - &(event->area), &allocation); + _gtk_toolbar_paint_space_line (widget, toolbar, cr); } return FALSE; diff --git a/gtk/gtktoolbar.c b/gtk/gtktoolbar.c index 5995bf0866..8f5264cb82 100644 --- a/gtk/gtktoolbar.c +++ b/gtk/gtktoolbar.c @@ -3618,14 +3618,14 @@ _gtk_toolbar_get_default_space_size (void) void _gtk_toolbar_paint_space_line (GtkWidget *widget, GtkToolbar *toolbar, - const GdkRectangle *area, - const GtkAllocation *allocation) + cairo_t *cr) { GtkToolbarPrivate *priv = toolbar->priv; GtkOrientation orientation; GtkStateType state; GtkStyle *style; GdkWindow *window; + int width, height; const double start_fraction = (SPACE_LINE_START / SPACE_LINE_DIVISION); const double end_fraction = (SPACE_LINE_END / SPACE_LINE_DIVISION); @@ -3636,6 +3636,8 @@ _gtk_toolbar_paint_space_line (GtkWidget *widget, style = gtk_widget_get_style (widget); window = gtk_widget_get_window (widget); state = gtk_widget_get_state (widget); + width = gtk_widget_get_allocated_width (widget); + height = gtk_widget_get_allocated_height (widget); if (orientation == GTK_ORIENTATION_HORIZONTAL) { @@ -3648,20 +3650,20 @@ _gtk_toolbar_paint_space_line (GtkWidget *widget, NULL); if (wide_separators) - gtk_paint_box (style, window, + gtk_cairo_paint_box (style, cr, state, GTK_SHADOW_ETCHED_OUT, - area, widget, "vseparator", - allocation->x + (allocation->width - separator_width) / 2, - allocation->y + allocation->height * start_fraction, + widget, "vseparator", + (width - separator_width) / 2, + height * start_fraction, separator_width, - allocation->height * (end_fraction - start_fraction)); + height * (end_fraction - start_fraction)); else - gtk_paint_vline (style, window, - state, area, widget, + gtk_cairo_paint_vline (style, cr, + state, widget, "toolbar", - allocation->y + allocation->height * start_fraction, - allocation->y + allocation->height * end_fraction, - allocation->x + (allocation->width - style->xthickness) / 2); + height * start_fraction, + height * end_fraction, + (width - style->xthickness) / 2); } else { @@ -3674,20 +3676,20 @@ _gtk_toolbar_paint_space_line (GtkWidget *widget, NULL); if (wide_separators) - gtk_paint_box (style, window, + gtk_cairo_paint_box (style, cr, state, GTK_SHADOW_ETCHED_OUT, - area, widget, "hseparator", - allocation->x + allocation->width * start_fraction, - allocation->y + (allocation->height - separator_height) / 2, - allocation->width * (end_fraction - start_fraction), + widget, "hseparator", + width * start_fraction, + (height - separator_height) / 2, + width * (end_fraction - start_fraction), separator_height); else - gtk_paint_hline (style, window, - state, area, widget, + gtk_cairo_paint_hline (style, cr, + state, widget, "toolbar", - allocation->x + allocation->width * start_fraction, - allocation->x + allocation->width * end_fraction, - allocation->y + (allocation->height - style->ythickness) / 2); + width * start_fraction, + width * end_fraction, + (height - style->ythickness) / 2); } } diff --git a/gtk/gtktoolbar.h b/gtk/gtktoolbar.h index 922fa0e790..99a278cfe8 100644 --- a/gtk/gtktoolbar.h +++ b/gtk/gtktoolbar.h @@ -127,8 +127,7 @@ void gtk_toolbar_set_drop_highlight_item (GtkToolbar *toolbar, gchar * _gtk_toolbar_elide_underscores (const gchar *original); void _gtk_toolbar_paint_space_line (GtkWidget *widget, GtkToolbar *toolbar, - const GdkRectangle *area, - const GtkAllocation *allocation); + cairo_t *cr); gint _gtk_toolbar_get_default_space_size (void); -- 2.30.2